home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Fonts.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  13KB  |  441 lines

  1. /*
  2.      File:        Fonts.h
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __FONTS__
  19. #define __FONTS__
  20.  
  21. #ifndef __GXTYPES__
  22. #include <GXTypes.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __TEXTCOMMON__
  28. #include <TextCommon.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT_SUPPORTED
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43.  
  44. enum {
  45.     systemFont                    = 0,
  46.     applFont                    = 1,
  47.     newYork                        = 2,
  48.     geneva                        = 3,
  49.     monaco                        = 4,
  50.     venice                        = 5,
  51.     london                        = 6,
  52.     athens                        = 7,
  53.     sanFran                        = 8,
  54.     toronto                        = 9,
  55.     cairo                        = 11,
  56.     losAngeles                    = 12,
  57.     times                        = 20,
  58.     helvetica                    = 21,
  59.     courier                        = 22,
  60.     symbol                        = 23,
  61.     mobile                        = 24,
  62.     commandMark                    = 17,
  63.     checkMark                    = 18,
  64.     diamondMark                    = 19
  65. };
  66.  
  67.  
  68. enum {
  69.     appleMark                    = 20,
  70.     propFont                    = 36864L,
  71.     prpFntH                        = 36865L,
  72.     prpFntW                        = 36866L,
  73.     prpFntHW                    = 36867L,
  74.     fixedFont                    = 45056L,
  75.     fxdFntH                        = 45057L,
  76.     fxdFntW                        = 45058L,
  77.     fxdFntHW                    = 45059L,
  78.     fontWid                        = 44208L
  79. };
  80.  
  81. struct FMInput {
  82.     short                             family;
  83.     short                             size;
  84.     Style                             face;
  85.     Boolean                         needBits;
  86.     short                             device;
  87.     Point                             numer;
  88.     Point                             denom;
  89. };
  90. typedef struct FMInput FMInput;
  91.  
  92. /*
  93.  #pragma output c
  94.  typedef struct OpaquePrivateFontResult *privateFontResult;
  95.  #pragma output pascal
  96.  typedef Ptr privateFontResult;
  97.  #pragma output all
  98. */
  99. typedef struct OpaqueFontResult* FontResult;
  100. struct FMOutput {
  101.     short                             errNum;
  102.     FontResult                         fontResult;
  103.     UInt8                             boldPixels;
  104.     UInt8                             italicPixels;
  105.     UInt8                             ulOffset;
  106.     UInt8                             ulShadow;
  107.     UInt8                             ulThick;
  108.     UInt8                             shadowPixels;
  109.     SInt8                             extra;
  110.     UInt8                             ascent;
  111.     UInt8                             descent;
  112.     UInt8                             widMax;
  113.     SInt8                             leading;
  114.     SInt8                             curStyle;
  115.     Point                             numer;
  116.     Point                             denom;
  117. };
  118. typedef struct FMOutput FMOutput;
  119.  
  120. typedef FMOutput *FMOutPtr;
  121. typedef FMOutput *FMOutputPtr;
  122. struct FontRec {
  123.     short                             fontType;                    /*font type*/
  124.     short                             firstChar;                    /*ASCII code of first character*/
  125.     short                             lastChar;                    /*ASCII code of last character*/
  126.     short                             widMax;                        /*maximum character width*/
  127.     short                             kernMax;                    /*negative of maximum character kern*/
  128.     short                             nDescent;                    /*negative of descent*/
  129.     short                             fRectWidth;                    /*width of font rectangle*/
  130.     short                             fRectHeight;                /*height of font rectangle*/
  131.     unsigned short                     owTLoc;                        /*offset to offset/width table*/
  132.     short                             ascent;                        /*ascent*/
  133.     short                             descent;                    /*descent*/
  134.     short                             leading;                    /*leading*/
  135.     short                             rowWords;                    /*row width of bit image / 2 */
  136. };
  137. typedef struct FontRec FontRec;
  138.  
  139. typedef FontRec *FontRecPtr;
  140. struct FMetricRec {
  141.     Fixed                             ascent;                        /*base line to top*/
  142.     Fixed                             descent;                    /*base line to bottom*/
  143.     Fixed                             leading;                    /*leading between lines*/
  144.     Fixed                             widMax;                        /*maximum character width*/
  145.     Handle                             wTabHandle;                    /*handle to font width table*/
  146. };
  147. typedef struct FMetricRec FMetricRec;
  148.  
  149. /*
  150.  typedef struct FMetricRec FMetricRec, *FMetricRecPtr;
  151.  typedef FMetricRecPtr *FMetricRecHandle;
  152. */
  153. typedef FMetricRec *FMetricRecPtr;
  154. typedef FMetricRecPtr *FMetricRecHandle;
  155. struct WidEntry {
  156.     short                             widStyle;                    /*style entry applies to*/
  157. };
  158. typedef struct WidEntry WidEntry;
  159.  
  160. struct WidTable {
  161.     short                             numWidths;                    /*number of entries - 1*/
  162. };
  163. typedef struct WidTable WidTable;
  164.  
  165. struct AsscEntry {
  166.     short                             fontSize;
  167.     short                             fontStyle;
  168.     short                             fontID;                        /*font resource ID*/
  169. };
  170. typedef struct AsscEntry AsscEntry;
  171.  
  172. struct FontAssoc {
  173.     short                             numAssoc;                    /*number of entries - 1*/
  174. };
  175. typedef struct FontAssoc FontAssoc;
  176.  
  177. struct StyleTable {
  178.     short                             fontClass;
  179.     long                             offset;
  180.     long                             reserved;
  181.     char                             indexes[48];
  182. };
  183. typedef struct StyleTable StyleTable;
  184.  
  185. struct NameTable {
  186.     short                             stringCount;
  187.     Str255                             baseFontName;
  188. };
  189. typedef struct NameTable NameTable;
  190.  
  191. struct KernPair {
  192.     char                             kernFirst;                    /*1st character of kerned pair*/
  193.     char                             kernSecond;                    /*2nd character of kerned pair*/
  194.     short                             kernWidth;                    /*kerning in 1pt fixed format*/
  195. };
  196. typedef struct KernPair KernPair;
  197.  
  198. struct KernEntry {
  199.     short                             kernStyle;                    /*style the entry applies to*/
  200.     short                             kernLength;                    /*length of this entry*/
  201. };
  202. typedef struct KernEntry KernEntry;
  203.  
  204. struct KernTable {
  205.     short                             numKerns;                    /*number of kerning entries*/
  206. };
  207. typedef struct KernTable KernTable;
  208.  
  209. struct WidthTable {
  210.     Fixed                             tabData[256];                /*character widths*/
  211.     FontResult                         fontResult;                    /*font record used to build table*/
  212.     long                             sExtra;                        /*space extra used for table*/
  213.     long                             style;                        /*extra due to style*/
  214.     short                             fID;                        /*font family ID*/
  215.     short                             fSize;                        /*font size request*/
  216.     short                             face;                        /*style (face) request*/
  217.     short                             device;                        /*device requested*/
  218.     Point                             inNumer;                    /*scale factors requested*/
  219.     Point                             inDenom;                    /*scale factors requested*/
  220.     short                             aFID;                        /*actual font family ID for table*/
  221.     Handle                             fHand;                        /*family record used to build up table*/
  222.     Boolean                         usedFam;                    /*used fixed point family widths*/
  223.     UInt8                             aFace;                        /*actual face produced*/
  224.     short                             vOutput;                    /*vertical scale output value*/
  225.     short                             hOutput;                    /*horizontal scale output value*/
  226.     short                             vFactor;                    /*vertical scale output value*/
  227.     short                             hFactor;                    /*horizontal scale output value*/
  228.     short                             aSize;                        /*actual size of actual font used*/
  229.     short                             tabSize;                    /*total size of table*/
  230. };
  231. typedef struct WidthTable WidthTable;
  232.  
  233. struct FamRec {
  234.     short                             ffFlags;                    /*flags for family*/
  235.     short                             ffFamID;                    /*family ID number*/
  236.     short                             ffFirstChar;                /*ASCII code of 1st character*/
  237.     short                             ffLastChar;                    /*ASCII code of last character*/
  238.     short                             ffAscent;                    /*maximum ascent for 1pt font*/
  239.     short                             ffDescent;                    /*maximum descent for 1pt font*/
  240.     short                             ffLeading;                    /*maximum leading for 1pt font*/
  241.     short                             ffWidMax;                    /*maximum widMax for 1pt font*/
  242.     long                             ffWTabOff;                    /*offset to width table*/
  243.     long                             ffKernOff;                    /*offset to kerning table*/
  244.     long                             ffStylOff;                    /*offset to style mapping table*/
  245.     short                             ffProperty[9];                /*style property info*/
  246.     short                             ffIntl[2];                    /*for international use*/
  247.     short                             ffVersion;                    /*version number*/
  248. };
  249. typedef struct FamRec FamRec;
  250.  
  251. typedef SInt16 FontPointSize;
  252. typedef SInt16 FontFamilyID;
  253. extern pascal void InitFonts(void )
  254.  ONEWORDINLINE(0xA8FE);
  255.  
  256. extern pascal void GetFontName(short familyID, Str255 name)
  257.  ONEWORDINLINE(0xA8FF);
  258.  
  259. extern pascal void GetFNum(ConstStr255Param name, short *familyID)
  260.  ONEWORDINLINE(0xA900);
  261.  
  262. extern pascal Boolean RealFont(short fontNum, short size)
  263.  ONEWORDINLINE(0xA902);
  264.  
  265. extern pascal void SetFontLock(Boolean lockFlag)
  266.  ONEWORDINLINE(0xA903);
  267.  
  268. extern pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  269.  ONEWORDINLINE(0xA901);
  270.  
  271. extern pascal void SetFScaleDisable(Boolean fscaleDisable)
  272.  ONEWORDINLINE(0xA834);
  273.  
  274. extern pascal void FontMetrics(FMetricRecPtr theMetrics)
  275.  ONEWORDINLINE(0xA835);
  276.  
  277. extern pascal void SetFractEnable(Boolean fractEnable)
  278.  ONEWORDINLINE(0xA814);
  279.  
  280. extern pascal short GetDefFontSize(void )
  281.  FIVEWORDINLINE(0x3EB8, 0x0BA8, 0x6604, 0x3EBC, 0x000C);
  282.  
  283. extern pascal Boolean IsOutline(Point numer, Point denom)
  284.  TWOWORDINLINE(0x7000, 0xA854);
  285.  
  286. extern pascal void SetOutlinePreferred(Boolean outlinePreferred)
  287.  TWOWORDINLINE(0x7001, 0xA854);
  288.  
  289. extern pascal Boolean GetOutlinePreferred(void )
  290.  TWOWORDINLINE(0x7009, 0xA854);
  291.  
  292. extern pascal OSErr OutlineMetrics(short byteCount, const void *textPtr, Point numer, Point denom, short *yMax, short *yMin, FixedPtr awArray, FixedPtr lsbArray, RectPtr boundsArray)
  293.  TWOWORDINLINE(0x7008, 0xA854);
  294.  
  295. extern pascal void SetPreserveGlyph(Boolean preserveGlyph)
  296.  TWOWORDINLINE(0x700A, 0xA854);
  297.  
  298. extern pascal Boolean GetPreserveGlyph(void )
  299.  TWOWORDINLINE(0x700B, 0xA854);
  300.  
  301. extern pascal OSErr FlushFonts(void )
  302.  TWOWORDINLINE(0x700C, 0xA854);
  303.  
  304. #if CGLUESUPPORTED
  305. extern void getfnum(const char *theName, short *familyID);
  306.  
  307. extern void getfontname(short familyID, char *theName);
  308.  
  309. #endif
  310. extern pascal short GetSysFont(void)
  311.  TWOWORDINLINE(0x3EB8, 0x0BA6);
  312.  
  313. extern pascal short GetAppFont(void)
  314.  TWOWORDINLINE(0x3EB8, 0x0984);
  315.  
  316. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  317. extern pascal void AntiTextSetApplicationAware(Boolean aware)
  318.  TWOWORDINLINE(0x7024, 0xA854);
  319.  
  320. extern pascal Boolean AntiTextGetApplicationAware(void )
  321.  TWOWORDINLINE(0x7025, 0xA854);
  322.  
  323. extern pascal void AntiTextSetEnabled(Boolean enabled)
  324.  TWOWORDINLINE(0x7026, 0xA854);
  325.  
  326. extern pascal Boolean AntiTextGetEnabled(void )
  327.  TWOWORDINLINE(0x7027, 0xA854);
  328.  
  329. extern pascal Boolean AntiTextIsAntiAliased(Point numer, Point denom)
  330.  TWOWORDINLINE(0x7028, 0xA854);
  331.  
  332. #endif
  333. #if FOR_SYSTEM8_COOPERATIVE
  334.  
  335. enum {
  336.     kSystemSpecialFont            = 1,
  337.     kApplicationSpecialFont        = 2,
  338.     kSmallSystemSpecialFont        = 3,
  339.     kEmphasisSpecialFont        = 4,
  340.     kKeyboardSymbolSpecialFont    = 5,
  341.     kCountSpecialFonts            = kKeyboardSymbolSpecialFont
  342. };
  343.  
  344. typedef UInt32 SpecialFontSelector;
  345. /* --------------------------------------------------------------*/
  346. typedef struct OpaqueTextStrikeRef* TextStrikeRef;
  347.  
  348. enum {
  349.     kDefaultTextStrike            = 0,
  350.     kAntiAliasTextStrike        = 0x0001,
  351.     kFractionalWidthsTextStrike    = 0x0002,
  352.     kPreserveGlyphTextStrike    = 0x0004
  353. };
  354.  
  355.  
  356. enum {
  357.     kPreserveTextStrikeElement    = 0x8000                        /* for QDSetStrikeElements */
  358. };
  359.  
  360. typedef OptionBits TextStrikeOption;
  361. /* --------------------------------------------------------------*/
  362. extern TextStrikeRef QDNewStrike(void );
  363.  
  364. extern void QDDisposeStrike(TextStrikeRef strike);
  365.  
  366. extern TextStrikeRef QDCloneStrike(TextStrikeRef strike);
  367.  
  368. extern TextStrikeRef QDCopyStrike(TextStrikeRef source);
  369.  
  370. extern void QDReplaceStrike(TextStrikeRef destination, TextStrikeRef source);
  371.  
  372. extern Boolean QDEqualStrike(TextStrikeRef strike1, TextStrikeRef strike2);
  373.  
  374. extern ItemCount QDStrikeOwnerCount(TextStrikeRef strike);
  375.  
  376. extern ByteCount QDFlattenStrike(TextStrikeRef strike, Byte stream[]);
  377.  
  378. extern TextStrikeRef QDUnflattenStrike(TextStrikeRef strike, const Byte stream[], ByteCount *size);
  379.  
  380. extern void QDGetStrikeElements(TextStrikeRef strike, short *familyID, short *styleBits, short *pointSize);
  381.  
  382. extern void QDSetStrikeElements(TextStrikeRef strike, short familyID, short styleBits, short pointSize);
  383.  
  384. extern TextStrikeOption QDGetStrikeOptions(TextStrikeRef strike);
  385.  
  386. extern void QDSetStrikeOptions(TextStrikeRef strike, TextStrikeOption options);
  387.  
  388. extern SpecialFontSelector QDGetStrikeSpecialFont(TextStrikeRef strike);
  389.  
  390. extern void QDSetStrikeSpecialFont(TextStrikeRef strike, SpecialFontSelector selector);
  391.  
  392. extern TextEncoding QDGetStrikeEncoding(TextStrikeRef strike);
  393.  
  394. extern void QDSetStrikeEncoding(TextStrikeRef strike, TextEncoding encoding);
  395.  
  396. extern ItemCount QDGetStrikeFeatures(TextStrikeRef strike, gxRunFeature features[]);
  397.  
  398. extern void QDSetStrikeFeatures(TextStrikeRef strike, ItemCount count, const gxRunFeature features[]);
  399.  
  400. extern ItemCount QDGetStrikeVariations(TextStrikeRef strike, gxFontVariation variations[]);
  401.  
  402. extern void QDSetStrikeVariations(TextStrikeRef strike, ItemCount count, const gxFontVariation variations[]);
  403.  
  404. extern gxMapping *QDGetStrikeMapping(TextStrikeRef strike, gxMapping *map);
  405.  
  406. extern void QDSetStrikeMapping(TextStrikeRef strike, const gxMapping *map);
  407.  
  408. extern TextStrikeRef QDGetPortStrike(CGrafPort *port);
  409.  
  410. extern void QDSetPortStrike(CGrafPort *port, TextStrikeRef strike);
  411.  
  412. extern ByteCount QDGetStrikeCustomItem(TextStrikeRef strike, OSType tag, BytePtr dataP);
  413.  
  414. extern void QDSetStrikeCustomItem(TextStrikeRef strike, OSType tag, BytePtr dataP, ByteCount size);
  415.  
  416. extern void QDSetStrikeColors(TextStrikeRef strike, RGBColor *foreColor, RGBColor *backColor);
  417.  
  418. extern void QDGetStrikeColors(TextStrikeRef strike, RGBColor *foreColor, RGBColor *backColor);
  419.  
  420. extern void QDSetStrikeTransferMode(TextStrikeRef strike, short textMode);
  421.  
  422. extern short QDGetStrikeTransferMode(TextStrikeRef strike);
  423.  
  424. /* --------------------------------------------------------------*/
  425. #endif
  426.  
  427. #if PRAGMA_ALIGN_SUPPORTED
  428. #pragma options align=reset
  429. #endif
  430.  
  431. #if PRAGMA_IMPORT_SUPPORTED
  432. #pragma import off
  433. #endif
  434.  
  435. #ifdef __cplusplus
  436. }
  437. #endif
  438.  
  439. #endif /* __FONTS__ */
  440.  
  441.